﻿namespace EveKillboard
{
    using System.Web.Mvc;
    using System.Web.Routing;

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            
            routes.MapRoute(
                "Admin", // Route name
                "Killboard/Admin/{action}/{id}", // URL with parameters
                new {controller = "Admin", action = "Index", id = UrlParameter.Optional} // Parameter defaults
            );
            routes.MapRoute(
               "Account", // Route name
               "Killboard/Account/{action}/{id}", // URL with parameters
               new { controller = "Account", action = "Index", id = UrlParameter.Optional } // Parameter defaults
           );
            routes.MapRoute(
                "Killboard", // Route name
                "Killboard/{action}/{id}", // URL with parameters
                new {controller = "Killboard", action = "Index", id = UrlParameter.Optional} // Parameter defaults
            );
            routes.MapRoute(
               "Default", // Route name
               "", // URL with parameters
               new { controller = "Killboard", action = "Index"} // Parameter defaults
           );
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}